<?php

namespace App\Http\Controllers\H5;


use App\WeChat\WechatDefaultConfig;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;

class BaseController extends Controller
{
    use WechatDefaultConfig;

    protected $sysMessageView = 'h5.message';

    public function __construct(Request $request)
    {
        parent::__construct($request);

        $this->middleware(function (Request $req, $next){
            $this->assign([
                'jssdk_config'=>$this->officialAccount()->jssdk->buildConfig(
                    [
                        'onMenuShareQQ',
                        'onMenuShareWeibo',
                        'scanQRCode',
                        'chooseImage',
                        'uploadImage',
                        'getLocation',
                        'openLocation'
                    ],
                    false, false, false)
            ]);
            return $next($req);
        });
    }
}
